﻿using System;
using System . Collections . Generic;
using System . Linq;
using System . Text;

namespace WenceyWang . RichMan4L
{
    public class GameEnvironment
    {
        Func<int> getTouzi { get; set; }

        public int GetTouzi ( )
        {
            return getTouzi?.Invoke ( ) ?? Game . Current . Randomer . Next ( 1 , 7 );
        }

        Action<InfomationCenter . Event> showEvent { get; set; }

        public void ShowEvent ( InfomationCenter . Event @event )
        {
            showEvent?.Invoke ( @event );
        }

        Action<Players . Player , Players . Models . Saying> playerSay { get; set; }

        public void PlayerSay ( Players . Player player , Players . Models . Saying saying )
        {
            playerSay?.Invoke ( player , saying );
        }

        Func<Stocks . Stock> stockPicker { get; set; }

        public Stocks . Stock StockPicker ( )
        {
            return stockPicker?.Invoke ( );
        }

        Func<Players . Player> playerPicker { get; set; }

        public Players . Player PlayerPicker ( )
        {
            return playerPicker?.Invoke ( );
        }

        Func<Maps . Road> roadPicker { get; set; }

        public Maps . Road RoadPicker ( )
        {
            return roadPicker?.Invoke ( );
        }

        Func<Maps . Area> areaPicker { get; set; }

        public Maps . Area AreaPicker ( )
        {
            return areaPicker?.Invoke ( );
        }

        Func<Maps . Area , Buffs . AreaBuff> areaBuffPicker { get; set; }

        Func<Players . Player , Buffs . PlayerBuff> playerBuffPicker { get; set; }

        Func<Maps . Road , Buffs . RoadBuff> roadBuffPicker { get; set; }

        Func<Stocks . Stock , Buffs . StockBuff> stockBuffPicker { get; set; }


        public Buffs . AreaBuff BuffPicker ( Maps . Area area )
        {
            return areaBuffPicker?.Invoke ( area );
        }

        public Buffs . PlayerBuff BuffPicker ( Players . Player player )
        {
            return playerBuffPicker?.Invoke ( player );
        }

        public Buffs . RoadBuff BuffPicker ( Maps . Road road )
        {
            return roadBuffPicker?.Invoke ( road );
        }

        public Buffs . StockBuff BuffPicker ( Stocks . Stock stock )
        {
            return stockBuffPicker?.Invoke ( stock );
        }


        public GameEnvironment ( )
        {

        }


        public GameEnvironment
            (
            Func<int> getTouzi,
            Action<InfomationCenter . Event> showEvent ,
            Action<Players . Player , Players . Models . Saying> playerSay ,
            Func<Stocks . Stock> stockPicker ,
            Func<Players . Player> playerPicker ,
            Func<Maps . Area> areaPicker ,
            Func<Maps . Area , Buffs . AreaBuff> areaBuffPicker ,
            Func<Players . Player , Buffs . PlayerBuff> playerBuffPicker ,
            Func<Maps . Road , Buffs . RoadBuff> roadBuffPicker ,
            Func<Stocks . Stock , Buffs . StockBuff> stockBuffPicker
            ) : this ( )
        {
            this . getTouzi = getTouzi;
            this . showEvent = showEvent;
            this . playerSay = playerSay;
            this . stockPicker = stockPicker;
            this . playerPicker = playerPicker;
            this . areaPicker = areaPicker;
            this . areaBuffPicker = areaBuffPicker;
            this . playerBuffPicker = playerBuffPicker;
            this . roadBuffPicker = roadBuffPicker;
            this . stockBuffPicker = stockBuffPicker;
        }
    }
}
